<%@ Language=VBScript %>
<% 

option explicit 
Response.Expires = -1
Server.ScriptTimeout = 600
' All communication must be in UTF-8, including the response back from the request
Session.CodePage  = 65001
%>

<!-- #include file="freeaspupload.asp" -->
<%

  Dim uploadsDirVar
  uploadsDirVar = "d:\webdata\AFND\www\diseases\uploader"
  'uploadsDirVar = Server.MapPath(".") & "\pops\"

function SaveVars
    Dim Upload
    Set Upload = New FreeASPUpload
	    Upload.Save(uploadsDirVar)
		
	Dim dis_id
	dis_id = Upload.Form("dis_id")
	Dim mesh
	mesh = Upload.Form("mesh")
	Dim mesh_array
	mesh_array = Split(mesh,"+")
	Dim mesh_id
	mesh_id = mesh_array(0)
	Dim dis_name
	dis_name = mesh_array(1)
	If dis_name = "other" Then
		dis_name = Upload.Form("dis_name_new")
		dis_name = Replace(dis_name,"'","")
	End If
	Dim dis_polyreg
	dis_polyreg = "KIR"
	Dim dis_city
	dis_city = Upload.Form("dis_city")
	dis_city = Replace(dis_city,"'","")
	Dim dis_region
	dis_region = Upload.Form("dis_region")
	dis_region = Replace(dis_region,"'","")
	Dim dis_couxcon
	dis_couxcon = Upload.Form("dis_couxcon")
	Dim couxcon_array
	couxcon_array = Split(dis_couxcon,",")
	Dim dis_country
	dis_country = couxcon_array(0)
	Dim dis_cont
	dis_cont = couxcon_array(1)
	Dim pop_lat1_deg
	pop_lat1_deg = Upload.Form("pop_lat1_deg")
	Dim pop_lat1_min
	pop_lat1_min = Upload.Form("pop_lat1_min")
	Dim pop_lat1_card
	pop_lat1_card = Upload.Form("pop_lat1_card")
	Dim pop_long1_deg
	pop_long1_deg = Upload.Form("pop_long1_deg")
	Dim pop_long1_min
	pop_long1_min = Upload.Form("pop_long1_min")
	Dim pop_long1_card
	pop_long1_card = Upload.Form("pop_long1_card")
	Dim dis_eth
	dis_eth = Upload.Form("dis_eth")
	Dim dis_sample_size_ctrls
	dis_sample_size_ctrls = Upload.Form("dis_sample_size_ctrls")
	Dim dis_sample_size_spec_ctrls
	dis_sample_size_spec_ctrls = Upload.Form("dis_sample_size_spec_ctrls")
	Dim	dis_sample_size_patients
	dis_sample_size_patients = Upload.Form("dis_sample_size_patients")
	Dim dis_method
	dis_method = Upload.Form("dis_method")
	Dim pop_source_ctrls
	pop_source_ctrls = Upload.Form("pop_source_ctrls")
	Dim dis_extra_notes
	dis_extra_notes = Upload.Form("dis_extra_notes")
	dis_extra_notes = Replace(dis_extra_notes,"'","")
	Dim dis_corr_auth
	dis_corr_auth = Upload.Form("dis_corr_auth")
	dis_corr_auth = Replace(dis_corr_auth,"'","")
	Dim dis_email
	dis_email = Upload.Form("dis_email")
	Dim dis_authors
	dis_authors = Upload.Form("dis_authors")
	dis_authors = Replace(dis_authors,"'","")
	Dim dis_year
	dis_year = Upload.Form("dis_year")
	Dim pop_id
	pop_id = Upload.Form("pop_id")
	Dim pop_array
	pop_array = Split(pop_id,"$")
	Dim afnd_id
	afnd_id = pop_array(0)
	Dim afnd_name
	afnd_name = pop_array(1)
	Dim dis_pub
	dis_pub = Upload.Form("dis_pub")
	Dim dis_pmid
	dis_pmid = Upload.Form("dis_pmid")
	If dis_pmid = "" Then
		dis_pmid = "0"
	End If
	Dim dis_status
	dis_status = "P"

	SaveVars = ""
    SaveVars = SaveVars & "<input type='hidden' name='dis_id' id='dis_id' value='" & dis_id & "' />"
    SaveVars = SaveVars & "<input type='hidden' name='mesh_id' id='mesh_id' value='" & mesh_id & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_name' id='dis_name' value='" & dis_name & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_polyreg' id='dis_polyreg' value='" & dis_polyreg & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_city' id='dis_city' value='" & dis_city & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_region' id='dis_region' value='" & dis_region & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_country' id='dis_country' value='" & dis_country & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_cont' id='dis_cont' value='" & dis_cont & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_lat1_deg' id='pop_lat1_deg' value='" & pop_lat1_deg & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_lat1_min' id='pop_lat1_min' value='" & pop_lat1_min & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_lat1_card' id='pop_lat1_card' value='" & pop_lat1_card & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_long1_deg' id='pop_long1_deg' value='" & pop_long1_deg & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_long1_min' id='pop_long1_min' value='" & pop_long1_min & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_long1_card' id='pop_long1_card' value='" & pop_long1_card & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_eth' id='dis_eth' value='" & dis_eth & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_sample_size_ctrls' id='dis_sample_size_ctrls' value='" & dis_sample_size_ctrls & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_sample_size_spec_ctrls' id='dis_sample_size_spec_ctrls' value='" & dis_sample_size_spec_ctrls & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_sample_size_patients' id='dis_sample_size_patients' value='" & dis_sample_size_patients & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_method' id='dis_method' value='" & dis_method & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='pop_source_ctrls' id='pop_source_ctrls' value='" & pop_source_ctrls & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_corr_auth' id='dis_corr_auth' value='" & dis_corr_auth & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_email' id='dis_email' value='" & dis_email & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_authors' id='dis_authors' value='" & dis_authors & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_year' id='dis_year' value='" & dis_year & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='afnd_id' id='afnd_id' value='" & afnd_id & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='afnd_name' id='afnd_name' value='" & afnd_name & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_pub' id='dis_pub' value='" & dis_pub & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_pmid' id='dis_pmid' value='" & dis_pmid & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_extra_notes' id='dis_extra_notes' value='" & dis_extra_notes & "' />"
	SaveVars = SaveVars & "<input type='hidden' name='dis_status' id='dis_status' value='" & dis_status & "' />"

	
end function
	  
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
'#-------------------------------------------------------------------------------#
'#  Description:       KIR-Add a disease association study.                      #
'#                     Code:      dis2001a.asp                                   #
'#  Authors:           Louise Yukari Cicalise Takeshita							 #
'#  Created:           19 Jun 2012                                               #
'#  Ended:             19 Jun 2012                                               #
'#  Last update:       19 Jun 2012                                               #
'#  Version:           1.0.0 - 19-Jun-2012                                       #
'#  Bugs:                                                                        #
'#-------------------------------------------------------------------------------#
%>

<!-- PAGE DESCRIPTION -->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="Description" content="Allele Frequencies Website" />
<meta name="Keywords" content="HLA, KIR, frequencies, allele, disease, association" />
<link rel="shortcut icon" href="../images/favicon.ico" />
<title>The Allele Frequency Net Database [Add Disease Association Study] </title>

<!-- CSS STYLE SHEETS -->
<link rel="stylesheet" type="text/css" href="../styles/format.css" />

<!-- ROUTINES -->
<script type="text/javascript" src="../routines/dis2001b.js"> </script>
<script type="text/javascript" src="../routines/logreg.js"> </script>

</head>

<body onload="ResetCounter();">


<%'-------------------------------------- M A I N    F R A M E W O R K ------------------------------------%>

<div style="width:950px; margin:0 auto; padding:5px 0px 5px 0px;">

<%'-------------------------------------- B O R D ER    F R A M E W O R K ---------------------------------%>
<div style="border:1px solid #0066FF;">    

<%
'#-----------------------------#
'#       H E A D E R           #
'#-----------------------------#
%>

<div id="divGenHeader">
		<table class="table10">
           <tr>
				<td><a href="default.asp"><img src="../images/banner.gif" alt="Allele Frequencies in World Populations" /></a></td>
		  </tr>
		</table>
</div>		

<%
'#-----------------------------#
'#   PROGRAM NAME              #
'#-----------------------------#
%>
<div id="divGenProg">
	<h2>KIR and diseases &raquo; Add New Disease Association Study</h2>
</div>

<%
'#-----------------------------#
'#   INSTRUCTIONS              #
'#-----------------------------#
%>
<div id="divGenInstructions">
	<h6>Instructions: Add Frequency Data</h6><br />
    <h3>How to define associated genes/genotypes:</h3>
	<p>Define your associated genes/genotypes by selecting <b>"1"</b> for presence and <b>"0"</b> for absence. Genes which are not included in your association <b>MUST</b> be left <b>BLANK</b>. See examples below:</p><br />
    <div style="margin-left:auto; margin-right:auto; width:610px">
    <img src="example1.png" alt="Association with single gene KIR2DL2" width="599" height="57" style="border:1.5px solid #CCC"/>
    <h5 style="text-align:center">Example 1: Association with single gene KIR2DL2</h5>
    </div>
    <br />
    <div style="margin-left:auto; margin-right:auto; width:610px">
    <img src="example2.png" alt="Association with AA genotype (ID:1)" width="599" height="57" style="border:1.5px solid #CCC"/>
    <h5 style="text-align:center">Example 2: Association with AA genotype (ID:1)</h5>
    <div style="text-align:center"><span style="font-size:10px">(Click <a href="http://allelefrequencies.net/kir6001a.asp" target="_blank">here</a> to access KIR genotype list.)</span></div>
    </div>
    <br />
    <div style="margin-left:auto; margin-right:auto; width:610px">
    <img src="example3.png" alt="Association with KIR 2DL2/2DL3 and HLA C2/C2" width="596" height="113" style="border:1.5px solid #CCC"/>
    <h5 style="text-align:center">Example 3: Association with KIR 2DL2/2DL3 and HLA C2/C2</h5>
    </div><br />
    <p>Click on "Save" after inserting your disease association data. Then click on "Add New Association" if you want to add other association data or click on "Next" if you have recorded all disease associations.</p>

<br /><br />
</div>

<%
'#-----------------------------#
'#   NAVIGATION OPTIONS        #
'#-----------------------------#
%>
<div id="divGenNavig">	
<h2 style="line-height:25px"><span style="color:#999">Demographic Data &raquo; </span>Frequency Data &raquo; <span style="color:#999">Raw Data &raquo; Confirmation</span></h2>
</div>

<%
'#------------------------------#
'#   SUBMISSION FORM	        #
'#------------------------------#
%>

<div id="divGenDetail">
<div style="min-height:650px; height:auto !important; height:650px">
<form method="POST" enctype="multipart/form-data" accept-charset="utf-8" action="dis2001d1.asp" name="freq_data" id="freq_data">
<input type="hidden" value="1" id="counter" name="counter" />
<input type="hidden" value="" id="pnt_assoc" name="pnt_assoc" />

<%'----- REQUESTED VARIABLES ------------%>
<%
    response.write SaveVars()
%>

     <div id="dynamicInput">
     	<div id="my1div">
        	<fieldset id="my1fs">
            <legend><b>Add your KIR and Disease Association</b></legend>
            <p style="text-indent:0"><i>You can select Haplogroup (AA or Bx) <b>OR</b> KIR genes combinations. You can choose any KIR genes combination (from single KIR gene to a full genotype). You can also select KIR ligands in combination with KIR genes <b>OR</b> Haplogroups.</i></p>
            <table>
            	<tr><td colspan="16"><i><b>KIR Haplogroup:</b></i></td></tr>
                <tr>
                   	<td colspan="16"><select name="haplogroup1" id="haplogroup1"><option value="">select</option><option value="Genotype AA">AA</option><option value="Genotype Bx">Bx</option></select></td>
				</tr>
                <tr><td></td></tr>
                <tr><td colspan="16"><i><b>KIR Genes:</b></i></td></tr>
                <tr>
           			<td>2DL1</td>
                    <td>2DL2</td>
                    <td>2DL3</td>
                    <td>2DL4</td>
                    <td>2DL5</td>
                    <td>2DP1</td>
                    <td>2DS1</td>
                    <td>2DS2</td>
                    <td>2DS3</td>
                    <td>2DS4</td>
                    <td>2DS5</td>
                    <td>3DL1</td>
                    <td>3DL2</td>
                    <td>3DL3</td>
                    <td>3DP1</td>
                    <td>3DS1</td>
                </tr>
            	<tr>
           			<td><select name="g2DL1_1" id="g2DL1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DL2_1" id="g2DL2_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DL3_1" id="g2DL3_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DL4_1" id="g2DL4_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DL5_1" id="g2DL5_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DP1_1" id="g2DP1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DS1_1" id="g2DS1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DS2_1" id="g2DS2_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DS3_1" id="g2DS3_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DS4_1" id="g2DS4_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g2DS5_1" id="g2DS5_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g3DL1_1" id="g3DL1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g3DL2_1" id="g3DL2_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g3DL3_1" id="g3DL3_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g3DP1_1" id="g3DP1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="g3DS1_1" id="g3DS1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
                </tr>
                <tr><td></td></tr>
                <tr><td colspan="16"><i><b>HLA Class I ligands:</b></i></td></tr>
           		<tr>	
                    <td>A3</td>
                    <td>A11</td>
                    <td>Bw4</td>
                    <td>Bw4<br />(80I)</td>
                    <td>C1</td>
                    <td>C2</td>
                </tr>
            	<tr>
           			<td><select name="gA3_1" id="gA3_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="gA11_1" id="gA11_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="gBw4_1" id="gBw4_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="gBw480i_1" id="gBw480i_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="gC1_1" id="gC1_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
					<td><select name="gC2_1" id="gC2_1"><option value="">-</option><option value="1">1</option><option value="0">0</option></select></td>
                </tr>
            </table>
            <br />
            <p style="text-indent:0"><i><b>Gene Frequency:</b></i></p>
    		<label for="gfc1">Controls(%):</label><input type="text" id="gfc1" name="gfc1" size="6" maxlength="10" value="0.00" onclick="clickclear(this,'0.00','');" onKeypress="return fctDecimalVal();" onblur="clickrecall(this,'0.00');" />&nbsp;&nbsp;&nbsp;
    		<label for="gfsc1">Special Controls(%):</label><input type="text" id="gfsc1" name="gfsc1" size="6" maxlength="10" value="0.00" onclick="clickclear(this,'0.00','');" onKeypress="return fctDecimalVal();" onblur="clickrecall(this,'0.00');"/>&nbsp;&nbsp;&nbsp;
    		<label for="gfp1">Patients(%):</label><input type="text" id="gfp1" name="gfp1" size="6" maxlength="10" value="0.00" onclick="clickclear(this,'0.00','');" onKeypress="return fctDecimalVal();" onblur="clickrecall(this,'0.00');"/>&nbsp;&nbsp;&nbsp;
			</br><p style="text-indent:0"><i>Statistic Data:</i></p>
    		<label for="odds1">Odds Ratio:</label><input lang="1" type="text" id="odds1" name="odds1" size="6" maxlength="10" value="0.00" onclick="clickclear(this,'0.00','');" onKeypress="return fctDecimalVal();" onblur="clickrecall(this,'0.00');"/>&nbsp;&nbsp;&nbsp;
    		<label for="pvalue1">P-value:</label><input type="text" id="pvalue1" name="pvalue1" size="6" maxlength="10" value="0.0" onKeypress="return fctDecimalVal();"/><br /><br />
    		<label for="stat1">Statistical Test:</label><select id="stat1" name="stat1" onchange="fctCheckValues('stat1','add_stat1');">
            	<option value="">select</option>
                <option value="Chi-square">Chi-square</option>
                <option value="Fisher's Exact">Fisher's Exact</option>
                <option value="other">other</option>
            </select>&nbsp;&nbsp;&nbsp;
    		<label for="corr1">Correction:</label><select id="corr1" name="corr1" onchange="fctCheckValues('corr1','add_corr1');">
            	<option value="None">None</option>
            	<option value="Bonferroni">Bonferroni</option>
                <option value="Yates">Yates</option>
                <option value="Svejgaard and Ryder">Svejgaard and Ryder</option>
                <option value="other">other</option>
            </select>
            <span id="add_stat1" style="display:none"><br /><i>Please specify Statistical Test: </i><input name="new_stat1" type="text" id="new_stat1" size="30" maxlength="80" /></span>
            <span id="add_corr1" style="display:none"><br /><i>Please specify Statistical Correction: </i><input name="new_corr1" type="text" id="new_corr1" size="30" maxlength="80"/></br></span>
            <br /><br />
     		<p style="text-indent:0"><i><b>After filling all fields above, click on "Save Association". </b></i><input type="button" value="Save Association" onClick="pntAssoc(); passAssocs();">&nbsp;&nbsp;&nbsp;<input type="button" value="Reset" onclick="rstFields();" /></p>
            
            </fieldset>
        </div>	
     </div>
     <div id="dynPrint">
     	<div id="assoc1" style="margin:10px; display:none"></div>
     </div>
     <div style="display:none" id="addAssoc">
     <br />
     <p style="text-indent:0"><i>Click on "Add New Association" to add other association data.</i></p>
     <input type="button" value="Add New Association" onClick="addInput('dynamicInput','dynPrint');">&nbsp;&nbsp;&nbsp;<input type="reset" id="reset_form" value="Reset All Associations" onclick="rstForm();" />
     </div>
     <div id="next" style="display:none">
     <br />
     <hr />
     <p style="text-indent:0"><i>If you have recorded all your associations, click on "Next".</i></p>
     <input type="submit" value="Next" />
     </div>
</form>
</div>
</div>
<%'#---------------------------------------------------- END FORM --------------------------------------------------%>
</div>
<%'--------------------------------------#            END BORDER FRAMEWORK       #----------------------------------%>

<%'------------------------------------------#           FOOTER             #--------------------------------------%>
<div id="divGenFooter" align="center">
<label style="background-color:#b8cce4; border:solid 1px #006699; color:#006699; width:200; font:normal 11px Arial;">
 &copy;2012 Allele Frequencies Website.     </label>   <br /><br />
<b>Allele frequency net:</b> a database and online repository for immune gene frequencies in worldwide populations. <br />
Gonzalez-Galarza FF, Christmas S, Middleton D and Jones AR
<i>Nucleic Acid Research 2011, 39, D913-D919.</i><br />
Liverpool, U.K. <a href="mailto:support@allelefrequencies.net"><br /><br />support@allelefrequencies.net</a>
<br /><br />
<a href="http://validator.w3.org/check?uri=referer" target="_blank"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</div>
<%'------------------------------------------#            END FOOTER       #--------------------------------------%>
</div>
<%'--------------------------------------#            END MAIN FRAMEWORK       #----------------------------------%>
</body>
</html>